package com.springcloud.demo.controller;

import com.springcloud.demo.pojo.Order;
import com.springcloud.demo.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;

/**
 * @Author: XiaoJie Wang
 * @Description:
 * @Date: Create in 10:17 2021/7/11
 */
@RestController
@RequestMapping("/order")
public class OrderController {

    @Autowired
    private OrderService orderService;


    @GetMapping(value = "/rest/{id}",produces = MediaType.APPLICATION_JSON_VALUE)
    public Order selectOrderByIdTemplate(@PathVariable("id") Integer id){
        return orderService.selectOrderByIdTemplate(id);
    }

    @GetMapping(value = "/feign",produces = MediaType.APPLICATION_JSON_VALUE)
    public Order selectOrderByIdFeign(@RequestParam(required = false)Integer id, @RequestParam(required = false) String productName){
        return orderService.selectOrderByIdFeign(id,productName);
    }
}
